local nya__guose = fk.CreateSkill {

  name = "nya__guose",

  tags = {  },

}



nya__guose:addEffect("active", {
  name = "nya__guose",
  anim_type = "control",
  min_card_num = 0,
  max_card_num = 1,
  target_num = 1,
  prompt = "#nya__guose",
  can_use = function(self, player)
    return player:usedSkillTimes(nya__guose.name, Player.HistoryPhase) < 4
  end,
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and Fk:getCardById(to_select).suit == Card.Diamond
  end,
  target_filter = function(self, player, to_select, selected)
    if #selected == 0 then
      local target = Fk:currentRoom():getPlayerById(to_select)
      if #selected_cards == 0 then
        return target:hasDelayedTrick("indulgence")
      else
        local card = Fk:cloneCard("indulgence")
        card:addSubcard(selected_cards[1])
        return to_select ~= player.id and not player:isProhibited(target, card)
      end
    end
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    if #effect.cards == 0 then
      for _, id in ipairs(target:getCardIds("j")) do
        local card = target:getVirualEquip(id)
        if not card then card = Fk:getCardById(id) end
        if card.name == "indulgence" then
          room:throwCard({id}, nya__guose.name, target, player)
        end
      end
    else
      room:useVirtualCard("indulgence", effect.cards, player, target, nya__guose.name)
    end
    if not player.dead then
      if not player:hasSkill("nya__play", true) then
        player:drawCards(2, nya__guose.name)
        room:askForDiscard(player, 1, 1, true, nya__guose.name, false)
      else
        player:drawCards(1, nya__guose.name)
      end
    end
  end,
})

return nya__guose